"undefined" == typeof jQuery && console.log("没有引用jquery库");
var cms_post_addfunc = new Array;

function dr_lang(e) {
    return "undefined" != typeof lang && void 0 !== lang[e] && lang[e] ? lang[e] : e
}

function dr_strtotime(e) {
    -1 == e.indexOf(" ") && (e += " 00:00:00");
    var a = e.replace(/:/g, "-"),
        t = (a = a.replace(/ /g, "-")).split("-"),
        r = new Date(Date.UTC(t[0], t[1] - 1, t[2], t[3] - 8, t[4], t[5]));
    return parseInt(r.getTime() / 1e3)
}

function dr_get_web_dir() {
    return "undefined" != typeof web_dir && web_dir ? web_dir : "/"
}

function dr_isEllipsis(e) {
    var a, t, r = e.cloneNode();
    return r.style.width = e.offsetWidth + "px", r.style.height = e.offsetHeight + "px", r.style.overflow = "auto", r.style.position = "absolute", r.style.zIndex = -1, r.style.opacity = 0, r.style.whiteSpace = "nowrap", r.innerHTML = e.innerHTML, (a = e.parentNode).appendChild(r), t = r.scrollWidth > r.offsetWidth, a.removeChild(r), t
}

function dr_is_mobile() {
    var e = navigator.userAgent,
        a = /(?:Windows Phone)/.test(e),
        t = /(?:SymbianOS)/.test(e) || a,
        r = /(?:Android)/.test(e),
        i = /(?:Firefox)/.test(e),
        o = (/(?:Chrome|CriOS)/.test(e), /(?:iPad|PlayBook)/.test(e) || r && !/(?:Mobile)/.test(e) || i && /(?:Tablet)/.test(e));
    return !(!(/(?:iPhone)/.test(e) && !o) && !r && !t)
}

function dr_ftable_mydelete(e) {
    var a = $(e);
    a.parent().find(".form-control-file").val("0"), a.parent().find(".form-control-link").val("0"), a.parent().find(".form-control-preview").val(""), a.parent().find(".ftable-show").hide(), a.parent().find(".ftable-delete").hide()
}

function dr_ftable_myfileinput(e, a) {
    var t = $(e);
    layer.open({
        type: 2,
        title: '<i class="fa fa-folder-open"></i>',
        fix: !0,
        scrollbar: !1,
        shadeClose: !0,
        shade: 0,
        area: ["50%", "50%"],
        btn: [dr_lang("确定")],
        yes: function (e, r) {
            var i = layer.getChildFrame("body", e),
                o = layer.load(2, {
                    time: 1e7
                });
            return $.ajax({
                type: "POST",
                dataType: "json",
                url: a,
                data: $(i).find("#myform").serialize(),
                success: function (a) {
                    if (layer.close(o), a.token) {
                        var r = a.token;
                        $(i).find("#myform input[name='" + r.name + "']").val(r.value)
                    }
                    if (1 == a.code) {
                        layer.close(e);
                        var n = a.data.result[0];
                        t.parent().find(".form-control2").val(n.id), t.parent().find(".form-control-link").val(n.url), t.parent().find(".form-control-preview").val(n.url), t.parent().find(".ftable-show").show(), t.parent().find(".ftable-delete").show(), dr_tips(1, a.msg)
                    } else dr_tips(0, a.msg);
                    return !1
                }
            }), !1
        },
        success: function (e, a) {
            dr_iframe_error(layer, a, 1)
        },
        content: a + "&is_iframe=1"
    })
}

function dr_ftable_myshow(e) {
    var a = $(e),
        t = a.parent().find(".form-control-link").val(),
        r = a.parent().find(".form-control-preview").val(),
        i = "400px";
    1 == is_mobile_cms && (i = "80%");
    var o = "";
    "undefined" != typeof is_cms_dev && is_cms_dev && (o = '<p style="text-align: center"><a href="' + r + '" target="_blank">' + r + "</a></p>"), top.layer.alert(o + '<p style="text-align: center"><a href="' + t + '" target="_blank"><img style="max-width:100%" src="' + r + "?" + Date.parse(new Date) + '"></a></p>', {
        shade: 0,
        shadeClose: !0,
        title: "",
        area: [i, i],
        btn: []
    })
}

function dr_ftable_textareainput(e) {
    var a = $("#" + e).val(),
        t = "50%",
        r = "50%";
    1 == is_mobile_cms && (t = r = "90%"), layer.open({
        type: 1,
        title: '<i class="fa fa-edit"></i>',
        fix: !0,
        scrollbar: !1,
        shadeClose: !0,
        shade: 0,
        area: [t, r],
        btn: [dr_lang("确定")],
        yes: function (a, t) {
            $("#" + e).val($("#form-" + e).val()), layer.close(a)
        },
        content: '<div style="padding:10px;height:100%;"><textarea style="height:100%;" id="form-' + e + '" class="form-control">' + a + "</textarea></div>"
    })
}

function dr_preview_video(e) {
    var a = "450px",
        t = 'width="350" height="280"';
    if (1 == is_mobile_cms) {
        a = "90%";
        t = 'width="90%" height="200"'
    }
    var r = "";
    "undefined" != typeof is_cms_dev && is_cms_dev && (r = '<p style="text-align: center"><a href="' + e + '" target="_blank">' + e + "</a></p>"), layer.alert(r + '<p style="text-align: center"> <video class="video-js vjs-default-skin" controls="" preload="auto" ' + t + '><source src="' + e + '" type="video/mp4"/></video>\n</p>', {
        shade: 0,
        shadeClose: !0,
        title: "",
        area: [a, a],
        btn: []
    })
}

function dr_preview_image(e) {
    var a = "400px";
    1 == is_mobile_cms && (a = "80%");
    var t = "";
    "undefined" != typeof is_cms_dev && is_cms_dev && (t = '<p style="text-align: center"><a href="' + e + '" target="_blank">' + e + "</a></p>"), top.layer.alert(t + '<p style="text-align: center"><a href="' + e + '" target="_blank"><img style="max-width:100%" src="' + e + "?" + Date.parse(new Date) + '"></a></p>', {
        shade: 0,
        shadeClose: !0,
        title: "",
        area: [a, a],
        btn: []
    })
}

function dr_preview_url(e) {
    var a = "400px";
    1 == is_mobile_cms && (a = "90%"), layer.alert('<div style="text-align: center;"><a href="' + e + '" target="_blank">' + e + "</a></div>", {
        shade: 0,
        title: "",
        area: [a, a],
        btn: []
    })
}

function dr_layer_tips(e, a) {
    layer.msg(e)
}

function dr_show_info(e, a) {
    a || (a = 50), 1 == is_mobile_cms ? a = height = "90" : height = "50", layer.open({
        type: 1,
        shade: 0,
        fix: !0,
        shadeClose: !0,
        title: dr_lang("查看"),
        area: [a + "%", height + "%"],
        content: '<div style="padding:20px;overflow-y:scroll">' + e + "</div>"
    })
}

function dr_tips(e, a, t) {
    t && "undefined" != t ? t *= 1e3 : t = 3e3;
    var r = 0;
    t < 0 ? r = 1 : 0 == e && (r = 1), r ? 0 == e ? layer.alert(a, {
        shade: 0,
        title: "",
        icon: 2
    }) : layer.alert(a, {
        shade: 0,
        title: "",
        icon: 1
    }) : layer.msg(a, {
        time: t
    })
}

function dr_cmf_tips(e, a, t) {
    dr_tips(e, a, t)
}

function dr_iframe(type, url, width, height, rt) {
    var title = "";
    title = "add" == type ? '<i class="fa fa-plus"></i> ' + dr_lang("添加") : "edit" == type ? '<i class="fa fa-edit"></i> ' + dr_lang("修改") : "send" == type ? '<i class="fa fa-send"></i> ' + dr_lang("推送") : "save" == type ? '<i class="fa fa-save"></i> ' + dr_lang("保存") : type, width || (width = "500px"), height || (height = "70%"), 1 == is_mobile_cms && (width = "95%", height = "90%"), layer.open({
        type: 2,
        title: title,
        fix: !0,
        scrollbar: !1,
        maxmin: !0,
        resize: !0,
        shadeClose: !0,
        shade: 0,
        area: [width, height],
        btn: [dr_lang("确定"), dr_lang("取消")],
        yes: function (index, layero) {
            var body = layer.getChildFrame("body", index);
            $(body).find(".form-group").removeClass("has-error");
            var loading = layer.load(2, {
                shade: [.3, "#fff"],
                time: 1e8
            });
            return $.ajax({
                type: "POST",
                dataType: "json",
                url: url,
                data: $(body).find("#myform").serialize(),
                success: function (json) {
                    if (layer.close(loading), json.token) {
                        var token = json.token;
                        $(body).find("#myform input[name='" + token.name + "']").val(token.value)
                    }
                    if (json.code) {
                        if (layer.close(index), json.data.jscode) return void eval(json.data.jscode);
                        json.data.tourl ? setTimeout("window.location.href = '" + json.data.tourl + "'", 2e3) : "nogo" == rt || setTimeout("window.location.reload(true)", 2e3), json.data.htmlfile && $.ajax({
                            type: "GET",
                            url: json.data.htmlfile,
                            dataType: "jsonp",
                            success: function (e) {},
                            error: function () {}
                        }), json.data.htmllist && $.ajax({
                            type: "GET",
                            url: json.data.htmllist,
                            dataType: "jsonp",
                            success: function (e) {},
                            error: function () {}
                        }), dr_cmf_tips(1, json.msg)
                    } else $(body).find("#dr_row_" + json.data.field).addClass("has-error"), dr_cmf_tips(0, json.msg, json.data.time);
                    return !1
                },
                error: function (e, a, t) {
                    dr_ajax_alert_error(e, this, t)
                }
            }), !1
        },
        success: function (e, a) {
            dr_iframe_error(layer, a, 0)
        },
        content: url + "&is_iframe=1"
    })
}

function dr_iframe_show(e, a, t, r, i) {
    var o = "";
    o = "show" == e ? '<i class="fa fa-search"></i> ' + dr_lang("查看") : "edit" == e ? '<i class="fa fa-edit"></i> ' + dr_lang("修改") : "code" == e ? '<i class="fa fa-code"></i> ' + dr_lang("代码") : "cart" == e ? '<i class="fa fa-shopping-cart"></i> ' + dr_lang("交易记录") : e, t || (t = "60%"), r || (r = "70%"), 1 == is_mobile_cms && (t = "95%", r = "90%"), layer.open({
        type: 2,
        title: o,
        fix: !0,
        maxmin: !0,
        scrollbar: !1,
        shadeClose: !0,
        shade: 0,
        area: [t, r],
        success: function (e, a) {
            dr_iframe_error(layer, a, 0)
        },
        end: function () {
            "load" == i && window.location.reload(!0)
        },
        content: a + "&is_iframe=1"
    })
}

function dr_insert_emoji(e) {
    1 == is_mobile_cms ? (width = "95%", height = "90%") : width = height = "70%", layer.open({
        type: 2,
        title: '<i class="fa fa-smile-o"></i> Emoji',
        fix: !0,
        scrollbar: !1,
        shadeClose: !0,
        shade: 0,
        area: [width, height],
        content: dr_get_web_dir() + "index.php?s=api&c=emoji&name=" + e
    })
}

function dr_ajax_confirm_url(url, msg, tourl) {
    layer.confirm(msg, {
        icon: 3,
        shade: 0,
        title: dr_lang("提示"),
        btn: [dr_lang("确定"), dr_lang("取消")]
    }, function (index) {
        layer.close(index);
        var loading = layer.load(2, {
            shade: [.3, "#fff"],
            time: 1e8
        });
        $.ajax({
            type: "GET",
            dataType: "json",
            url: url,
            success: function (json) {
                if (layer.close(loading), json.code) {
                    if (json.data.jscode) return void eval(json.data.jscode);
                    json.data.url ? setTimeout("window.location.href = '" + json.data.url + "'", 2e3) : tourl && setTimeout("window.location.href = '" + tourl + "'", 2e3)
                }
                dr_cmf_tips(json.code, json.msg)
            },
            error: function (e, a, t) {
                dr_ajax_alert_error(e, this, t)
            }
        })
    })
}

function dr_ajax_url(e) {
    var a = layer.load(2, {
        shade: [.3, "#fff"],
        time: 1e8
    });
    $.ajax({
        type: "GET",
        url: e,
        dataType: "json",
        success: function (e) {
            layer.close(a), 0 == e.code && ($(".fc-code img").click(), e.data.field && ($("#dr_row_" + e.data.field).addClass("has-error"), $("#dr_" + e.data.field).focus())), dr_cmf_tips(e.code, e.msg, e.data.time), e.data.url && setTimeout("window.location.href = '" + e.data.url + "'", 2e3)
        },
        error: function (e, a, t) {
            dr_ajax_alert_error(e, this, t)
        }
    })
}

function dr_ajaxp_url(e) {
    var a = layer.load(2, {
        shade: [.3, "#fff"],
        time: 1e8
    });
    $.ajax({
        type: "GET",
        url: e,
        dataType: "jsonp",
        success: function (e) {
            layer.close(a), dr_cmf_tips(e.code, e.msg, e.data.time), e.data.url && setTimeout("window.location.href = '" + e.data.url + "'", 2e3)
        },
        error: function (e, a, t) {
            dr_ajax_alert_error(e, this, t)
        }
    })
}

function dr_ajax_save(e, a, t) {
    var r = layer.load(2, {
        shade: [.3, "#fff"],
        time: 5e3
    });
    $.ajax({
        type: "GET",
        url: a + "&name=" + t + "&value=" + e,
        dataType: "json",
        success: function (e) {
            layer.close(r), dr_tips(e.code, e.msg, e.data.time)
        },
        error: function (e, a, t) {
            dr_ajax_admin_alert_error(e, a, t)
        }
    })
}

function dr_ajax_option(url, msg, remove) {
    layer.confirm(msg, {
        icon: 3,
        shade: 0,
        title: dr_lang("提示"),
        btn: [dr_lang("确定"), dr_lang("取消")]
    }, function (index) {
        layer.close(index);
        var loading = layer.load(2, {
            shade: [.3, "#fff"],
            time: 1e8
        });
        $.ajax({
            type: "POST",
            dataType: "json",
            url: url,
            data: $("#myform").serialize(),
            success: function (json) {
                if (layer.close(loading), json.token) {
                    var token = json.token;
                    $("#myform input[name='" + token.name + "']").val(token.value)
                }
                if (json.code) {
                    if (remove) {
                        var ids = json.data.ids;
                        if (void 0 !== ids) {
                            console.log(ids);
                            for (var i = 0; i < ids.length; i++) $("#dr_row_" + ids[i]).remove()
                        }
                    }
                    if (json.data.htmlfile && $.ajax({
                            type: "GET",
                            url: json.data.htmlfile,
                            dataType: "jsonp",
                            success: function (e) {},
                            error: function () {}
                        }), json.data.jscode) return void eval(json.data.jscode);
                    json.data.url ? setTimeout("window.location.href = '" + json.data.url + "'", 2e3) : setTimeout("window.location.reload(true)", 3e3)
                }
                dr_cmf_tips(json.code, json.msg, json.data.time)
            },
            error: function (e, a, t) {
                dr_ajax_alert_error(e, this, t)
            }
        })
    })
}

function dr_ajax_option_url(e, a, t) {
    layer.confirm(a, {
        icon: 3,
        shade: 0,
        title: dr_lang("提示"),
        btn: [dr_lang("确定"), dr_lang("取消")]
    }, function (a) {
        layer.close(a);
        var r = layer.load(2, {
            shade: [.3, "#fff"],
            time: 1e8
        });
        $.ajax({
            type: "POST",
            dataType: "json",
            url: e,
            data: $("#myform").serialize(),
            success: function (e) {
                if (layer.close(r), e.token) {
                    var a = e.token;
                    $("#myform input[name='" + a.name + "']").val(a.value)
                }
                e.code && (e.data.url ? setTimeout("window.location.href = '" + e.data.url + "'", 2e3) : setTimeout("window.location.href = '" + t + "'", 2e3)), dr_cmf_tips(e.code, e.msg, e.data.time)
            },
            error: function (e, a, t) {
                dr_ajax_alert_error(e, this, t)
            }
        })
    })
}

function dr_ajax_submit(e, a, t, r) {
    var i = $("[id=" + a + "]").length;
    if (0 != i)
        if (i > 1) dr_cmf_tips(0, dr_lang("表单id属性已重复定义") + " (" + a + ")");
        else {
            var o = $("#" + a).find("[name=is_tips]");
            "required" == o.val() && o.val(""), 1 == $("#" + a).find("[name=is_admin]").val() && $("#" + a).find(".dr_required").each(function () {
                $(this).val() || o.val("required")
            });
            var n = o.val();
            n ? ("required" == n && (n = dr_lang("有必填字段未填写，确认提交吗？")), layer.confirm(n, {
                icon: 3,
                shade: 0,
                title: dr_lang("提示"),
                btn: [dr_lang("确定"), dr_lang("取消")]
            }, function (i) {
                dr_post_submit(e, a, t, r)
            })) : dr_post_submit(e, a, t, r)
        }
    else dr_cmf_tips(0, dr_lang("表单id属性不存在") + " (" + a + ")")
}

function dr_post_addfunc(e) {
    cms_post_addfunc.push(e)
}

function dr_post_submit(e, a, t, r) {
    var i = e.split("/");
    if ("http:" != i[0] && "https:" != i[0] || document.location.protocol == i[0]) {
        e = e.replace(/&page=\d+&page/g, "&page"), $("#" + a + " .form-group").removeClass("has-error");
        for (var o = 0; o < cms_post_addfunc.length; o++) {
            var n = (0, cms_post_addfunc[o])();
            if (n) return void dr_cmf_tips(0, n)
        }
        var d = layer.load(2, {
            shade: [.3, "#fff"],
            time: 1e8
        });
        $.ajax({
            type: "POST",
            dataType: "json",
            url: e,
            data: $("#" + a).serialize(),
            success: function (i) {
                if (layer.close(d), i.token) {
                    var o = i.token;
                    $("#" + a + " input[name='" + o.name + "']").val(o.value)
                }
                if (i.code) {
                    if (dr_cmf_tips(1, i.msg, i.data.time), i.data.htmlfile && $.ajax({
                            type: "GET",
                            url: i.data.htmlfile,
                            dataType: "jsonp",
                            success: function (e) {},
                            error: function () {}
                        }), i.data.htmllist && $.ajax({
                            type: "GET",
                            url: i.data.htmllist,
                            dataType: "jsonp",
                            success: function (e) {},
                            error: function () {}
                        }), t) {
                        var n = e;
                        "" != r && null != r && "undefined" != r ? n = r : i.data.url && (n = i.data.url), setTimeout("window.location.href = '" + n + "'", t)
                    }
                    "undefined" != typeof admin_file && admin_file && dr_sync_cache(0)
                } else i.data.button ? layer.alert(i.msg, {
                    shade: 0,
                    title: "",
                    btn: [i.data.button.name],
                    icon: 2
                }, function () {
                    window.open(i.data.button.url, "_blank").location
                }) : dr_cmf_tips(0, i.msg, i.data.time), $("#" + a + " .fc-code img").click(), i.data.field && ($("#" + a + " #dr_row_" + i.data.field).addClass("has-error"), $("#" + a + " #dr_" + i.data.field).focus())
            },
            error: function (e, a, t) {
                dr_ajax_alert_error(e, this, t)
            }
        })
    } else alert("当前提交的URL是" + i[0] + "模式，请使用" + document.location.protocol + "模式访问再提交")
}

function dr_loginout(e) {
    $.ajax({
        type: "GET",
        dataType: "json",
        url: dr_get_web_dir() + "index.php?s=api&c=api&m=loginout",
        success: function (a) {
            for (var t = a.data.sso, r = 0; r < t.length; r++) {
                fetchJsonp(t[r], {
                    jsonpCallback: "callback",
                    timeout: 3e3
                }).then(function (e) {
                    return e.json()
                }).then(function (e) {}).catch(function (e) {})
            }
            dr_cmf_tips(1, a.msg, a.data.time), e && "退出成功" != e ? setTimeout("window.location.href = '" + e + "'", 2e3) : setTimeout('window.location.href="' + a.data.url + '"', 2e3)
        },
        error: function (e, a, t) {
            dr_ajax_alert_error(e, this, t)
        }
    })
}

function dr_ajax_member(e, a, t) {
    var r = $("[id=" + a + "]").length;
    if (0 != r)
        if (r > 1) dr_cmf_tips(0, dr_lang("表单id属性已重复定义") + " (" + a + ")");
        else {
            var i = layer.load(2, {
                shade: [.3, "#fff"],
                time: 1e8
            });
            $("#" + a + " .form-group").removeClass("has-error"), $.ajax({
                type: "POST",
                dataType: "json",
                url: e,
                data: $("#" + a).serialize(),
                success: function (e) {
                    if (layer.close(i), e.token) {
                        var r = e.token;
                        $("#" + a + " input[name='" + r.name + "']").val(r.value)
                    }
                    if (e.code) {
                        for (var o = e.data.sso, n = 0; n < o.length; n++) {
                            fetchJsonp(o[n], {
                                jsonpCallback: "callback",
                                timeout: 3e3
                            }).then(function (e) {
                                return e.json()
                            }).then(function (e) {}).catch(function (e) {})
                        }
                        void 0 !== t && t && t.length > 2 ? (dr_cmf_tips(1, e.msg, e.data.time), setTimeout('window.location.href="' + t + '"', 3e3)) : e.data.url && (o.length > 2 ? (dr_cmf_tips(1, e.msg, e.data.time), setTimeout('window.location.href="' + e.data.url + '"', 3e3)) : window.location.href = e.data.url)
                    } else dr_cmf_tips(0, e.msg, e.data.time), $(".fc-code img").click(), e.data.field && ($("#dr_row_" + e.data.field).addClass("has-error"), $("#dr_" + e.data.field).focus())
                },
                error: function (e, a, t) {
                    dr_ajax_alert_error(e, this, t)
                }
            })
        }
    else dr_cmf_tips(0, dr_lang("表单id属性不存在") + " (" + a + ")")
}

function d_topinyin(e, a, t) {
    var r = $("#dr_" + a).val();
    if ($("#dr_" + e).val()) return !1;
    $.get("/index.php?s=api&c=api&m=pinyin&name=" + r + "&rand=" + Math.random(), function (a) {
        $("#dr_" + e).val(a), t && $("#dr_letter").val(a.substr(0, 1))
    })
}

function dr_file_remove(e) {
    $(e).parents(".files_row").remove()
}

function dr_file_delete(e, a) {
    $.get("/index.php?s=api&c=file&m=file_delete&id=" + a + "&rand=" + Math.random(), function (a) {
        top.dr_cmf_tips(a.code, a.msg), a.code && $(e).parents(".files_row").remove()
    }, "json")
}

function dr_file_edit(e) {
    $(e).parents(".files_row").find(".files_row_name").focus()
}

function dr_show_ip(e) {
    $.get(dr_get_web_dir() + "index.php?is_ajax=1&s=api&c=api&m=ip_address&value=" + $("#dr_" + e).val(), function (e) {
        layer.alert(e, {
            shade: 0,
            title: "",
            icon: 1
        })
    }, "text")
}

function dr_diy_func(e) {
    dr_cmf_tips(1, "这是一个自定义函数")
}

function dr_module_favorite(e, a) {
    $.get(dr_get_web_dir() + "index.php?is_ajax=1&s=api&app=" + e + "&c=module&m=favorite&id=" + a, function (e) {
        dr_cmf_tips(e.code, e.msg), e.code && $("#module_favorite_" + a).html(e.data)
    }, "json")
}

function dr_module_digg(e, a, t) {
    $.get(dr_get_web_dir() + "index.php?is_ajax=1&s=api&app=" + e + "&c=module&m=digg&id=" + a + "&value=" + t, function (e) {
        dr_cmf_tips(e.code, e.msg), e.code && $("#module_digg_" + a + "_" + t).html(e.data)
    }, "json")
}

function dr_select_paytype(e) {
    $("#dr_payselect").val(e)
}

function dr_show_protocol() {
    layer.open({
        type: 2,
        title: dr_lang("用户注册协议"),
        shadeClose: !0,
        area: ["70%", "70%"],
        content: dr_get_web_dir() + "index.php?s=member&c=api&m=protocol"
    })
}

function d_tips(e, a, t) {
    var r = $("#dr_" + e + "_tips");
    r.html() || r.html(""), a ? t && dr_cmf_tips(1, t) : ($("#dr_" + e).focus(), t && dr_cmf_tips(0, t))
}

function check_title(e) {
    var a = $("#dr_id").val(),
        t = $("#dr_title").val(),
        r = $("#dr_module").val();
    $.get(dr_get_web_dir() + "index.php?s=api&c=api&m=checktitle&title=" + t + "&module=" + r + "&id=" + a + "&is_ajax=1", function (e) {
        e && dr_cmf_tips(0, e)
    })
}

function get_keywords(e) {
    var a = $("#dr_title").val(),
        t = $("#dr_module").val();
    if ($("#dr_" + e).val()) return !1;
    $.get(dr_get_web_dir() + "index.php?s=api&c=api&m=getkeywords&title=" + a + "&module=" + t + "&is_ajax=1", function (a) {
        $("#dr_" + e).val(a), $("#dr_" + e).tagsinput("add", a)
    })
}

function d_required(e) {
    return "" == $("#dr_" + e).val() ? (d_tips(e, !1), !0) : (d_tips(e, !0), !1)
}

function d_isemail(e) {
    var a = $("#dr_" + e).val();
    return /^[-_A-Za-z0-9]+@([_A-Za-z0-9]+\.)+[A-Za-z0-9]{2,3}$/.test(a) ? (d_tips(e, !0), !1) : (d_tips(e, !1), !0)
}

function d_isurl(e) {
    var a = $("#dr_" + e).val();
    return 1 == new RegExp(/http(s)?:\/\/([\w-]+\.)+[\w-]+(\/[\w- .\/?%&=]*)?/).test(a) ? (d_tips(e, !0), !1) : (d_tips(e, !1), !0)
}

function d_isdomain(e) {
    return $("#dr_" + e).val().indexOf("/") > 0 ? (d_tips(e, !1), !0) : (d_tips(e, !0), !1)
}

function dr_iframe_error(e, a, t = 0) {
    var r = e.getChildFrame("body", a),
        i = $(r).html();
    if ((i = i.replace(/<.*?>/g, "")).indexOf('"code":0') > 0 && i.length < 150) {
        var o = JSON.parse(i);
        e.close(a), dr_cmf_tips(0, o.msg)
    }
    if (1 == t && i.indexOf('"code":1') > 0 && i.length < 150) {
        o = JSON.parse(i);
        e.close(a), dr_tips(1, o.msg)
    }
}

function dr_ajax_alert_error(e, a, t) {
    if (layer.closeAll("loading"), "undefined" != typeof is_admin && is_admin) {
        var r = e.responseText,
            i = "请求状态：" + e.status + "<br>";
        i += "请求方式：" + a.type + "<br>", i += "请求地址：" + a.url + "<br>", r || (r = t), "1" == is_admin ? layer.open({
            type: 1,
            title: dr_lang("系统崩溃，请检查错误日志"),
            fix: !0,
            shadeClose: !0,
            shade: 0,
            area: ["50%", "50%"],
            btn: [dr_lang("查看日志")],
            yes: function (e, a) {
                layer.close(e), dr_iframe_show(dr_lang("错误日志"), admin_file + "?c=error&m=log_show")
            },
            content: '<div style="padding:10px;border-bottom: 1px solid #eee;">' + i + '</div><div style="padding:10px;">' + r + "</div>"
        }) : layer.open({
            type: 1,
            title: dr_lang("系统崩溃，请检查错误日志"),
            fix: !0,
            shadeClose: !0,
            shade: 0,
            area: ["50%", "50%"],
            content: '<div style="padding:10px;border-bottom: 1px solid #eee;">' + i + '</div><div style="padding:10px;">' + r + "</div>"
        })
    } else dr_cmf_tips(0, dr_lang("系统错误"))
}

function dr_slimScroll_init(e, a) {
    if ($().slimScroll) {
        var t, r = e + " .scroller",
            i = e + " .scroller_body";
        if ("1" === $(r).attr("data-inited")) {
            $(r).removeAttr("data-inited"), $(r).removeAttr("style");
            var o = {};
            $(r).attr("data-handle-color") && (o["data-handle-color"] = $(r).attr("data-handle-color")), $(r).attr("data-wrapper-class") && (o["data-wrapper-class"] = $(r).attr("data-wrapper-class")), $(r).attr("data-rail-color") && (o["data-rail-color"] = $(r).attr("data-rail-color")), $(r).attr("data-always-visible") && (o["data-always-visible"] = $(r).attr("data-always-visible")), $(r).attr("data-rail-visible") && (o["data-rail-visible"] = $(r).attr("data-rail-visible")), $(r).slimScroll({
                wrapperClass: $(r).attr("data-wrapper-class") ? $(r).attr("data-wrapper-class") : "slimScrollDiv",
                destroy: !0
            });
            var n = $(r);
            $.each(o, function (e, a) {
                n.attr(e, a)
            })
        }
        t = $(i).height() > a ? a : "auto", $(r).slimScroll({
            allowPageScroll: !1,
            size: "7px",
            color: $(r).attr("data-handle-color") ? $(r).attr("data-handle-color") : "#bbb",
            wrapperClass: $(r).attr("data-wrapper-class") ? $(r).attr("data-wrapper-class") : "slimScrollDiv",
            railColor: $(r).attr("data-rail-color") ? $(r).attr("data-rail-color") : "#eaeaea",
            position: "right",
            height: t,
            alwaysVisible: "1" == $(r).attr("data-always-visible"),
            railVisible: "1" == $(r).attr("data-rail-visible"),
            disableFadeOut: !0
        }), $(r).attr("data-inited", "1")
    }
}
$(function () {
        ($(document).width() < 600 ? ($(".hidden-mobile").hide(), $(".table").attr("style", "table-layout: inherit!important;")) : $(".hidden-mobile").show(), $(".table .heading th").click(function (e) {
            var a = $(this).attr("class");
            if ("" != a && null != a) {
                var t = $(this).attr("name");
                if ("" != t && null != t) {
                    var r = "";
                    r = "order_sorting" == a ? "desc" : "order_sorting_desc" == a ? "asc" : "desc";
                    var i = decodeURI(window.location.href);
                    i = i.replace("&order=", "&"), i += "&order=" + t + " " + r, window.location.href = i
                }
            }
        }), $(".table-checkable")) && $(".table-checkable").find(".group-checkable").change(function () {
            var e = jQuery(this).attr("data-set"),
                a = jQuery(this).is(":checked");
            jQuery(e).each(function () {
                a ? ($(this).prop("checked", !0), $(this).parents("tr").addClass("active")) : ($(this).prop("checked", !1), $(this).parents("tr").removeClass("active"))
            })
        })
    }),
    function (e, a) {
        if ("function" == typeof define && define.amd) define(["exports", "module"], a);
        else if ("undefined" != typeof exports && "undefined" != typeof module) a(exports, module);
        else {
            var t = {
                exports: {}
            };
            a(t.exports, t), e.fetchJsonp = t.exports
        }
    }(this, function (e, a) {
        "use strict";
        var t = {
            timeout: 5e3,
            jsonpCallback: "callback",
            jsonpCallbackFunction: null
        };

        function r(e) {
            try {
                delete window[e]
            } catch (a) {
                window[e] = void 0
            }
        }

        function i(e) {
            var a = document.getElementById(e);
            a && document.getElementsByTagName("head")[0].removeChild(a)
        }
        a.exports = function (e) {
            var a = arguments.length <= 1 || void 0 === arguments[1] ? {} : arguments[1],
                o = e,
                n = a.timeout || t.timeout,
                d = a.jsonpCallback || t.jsonpCallback,
                l = void 0;
            return new Promise(function (t, s) {
                var c = a.jsonpCallbackFunction || "jsonp_" + Date.now() + "_" + Math.ceil(1e5 * Math.random()),
                    f = d + "_" + c;
                window[c] = function (e) {
                    t({
                        ok: !0,
                        json: function () {
                            return Promise.resolve(e)
                        }
                    }), l && clearTimeout(l), i(f), r(c)
                }, o += -1 === o.indexOf("?") ? "?" : "&";
                var _ = document.createElement("script");
                _.setAttribute("src", "" + o + d + "=" + c), a.charset && _.setAttribute("charset", a.charset), _.id = f, document.getElementsByTagName("head")[0].appendChild(_), l = setTimeout(function () {
                    s(new Error("JSONP request to " + e + " timed out")), r(c), i(f), window[c] = function () {
                        r(c)
                    }
                }, n), _.onerror = function () {
                    s(new Error("JSONP request to " + e + " failed")), r(c), i(f), l && clearTimeout(l)
                }
            })
        }
    });


/*!
 * layer - 通用 Web 弹出层组件
 * MIT Licensed
 */
;
! function (e, t) {
    "use strict";
    var i, n, a = e.layui && layui.define,
        o = {
            getPath: function () {
                var e = document.currentScript ? document.currentScript.src : function () {
                    for (var e, t = document.scripts, i = t.length - 1, n = i; n > 0; n--)
                        if ("interactive" === t[n].readyState) {
                            e = t[n].src;
                            break
                        } return e || t[i].src
                }();
                return e.substring(0, e.lastIndexOf("/") + 1)
            }(),
            config: {},
            end: {},
            minIndex: 0,
            minLeft: [],
            btn: [dr_lang('确定'), dr_lang('取消')],
            type: ["dialog", "page", "iframe", "loading", "tips"],
            getStyle: function (t, i) {
                var n = t.currentStyle ? t.currentStyle : e.getComputedStyle(t, null);
                return n[n.getPropertyValue ? "getPropertyValue" : "getAttribute"](i)
            },
            link: function (t, i, n) {
                if (r.path) {
                    var a = document.getElementsByTagName("head")[0],
                        s = document.createElement("link");
                    "string" == typeof i && (n = i);
                    var l = (n || t).replace(/\.|\//g, ""),
                        f = "layuicss-" + l,
                        c = 0;
                    s.rel = "stylesheet", s.href = r.path + t, s.id = f, document.getElementById(f) || a.appendChild(s), "function" == typeof i && ! function u() {
                        return ++c > 80 ? e.console && console.error("layer.css: Invalid") : void(1989 === parseInt(o.getStyle(document.getElementById(f), "width")) ? i() : setTimeout(u, 100))
                    }()
                }
            }
        },
        r = {
            v: "3.1.1",
            ie: function () {
                var t = navigator.userAgent.toLowerCase();
                return !!(e.ActiveXObject || "ActiveXObject" in e) && ((t.match(/msie\s(\d+)/) || [])[1] || "11")
            }(),
            index: e.layer && e.layer.v ? 1e5 : 0,
            path: o.getPath,
            config: function (e, t) {
                return e = e || {}, r.cache = o.config = i.extend({}, o.config, e), r.path = o.config.path || r.path, "string" == typeof e.extend && (e.extend = [e.extend]), o.config.path && r.ready(), e.extend ? (a ? layui.addcss("modules/layer/" + e.extend) : o.link("theme/" + e.extend), this) : this
            },
            ready: function (e) {
                var t = "layer",
                    i = "",
                    n = (a ? "modules/layer/" : "layer/theme/") + "default/layer.css?v=" + r.v + i;
                return a ? layui.addcss(n, e, t) : o.link(n, e, t), this
            },
            alert: function (e, t, n) {
                var a = "function" == typeof t;
                return a && (n = t), r.open(i.extend({
                    content: e,
                    yes: n
                }, a ? {} : t))
            },
            confirm: function (e, t, n, a) {
                var s = "function" == typeof t;
                return s && (a = n, n = t), r.open(i.extend({
                    content: e,
                    btn: o.btn,
                    yes: n,
                    btn2: a
                }, s ? {} : t))
            },
            msg: function (e, n, a) {
                var s = "function" == typeof n,
                    f = o.config.skin,
                    c = (f ? f + " " + f + "-msg" : "") || "layui-layer-msg",
                    u = l.anim.length - 1;
                return s && (a = n), r.open(i.extend({
                    content: e,
                    time: 3e3,
                    shade: !1,
                    skin: c,
                    title: !1,
                    closeBtn: !1,
                    btn: !1,
                    resize: !1,
                    end: a
                }, s && !o.config.skin ? {
                    skin: c + " layui-layer-hui",
                    anim: u
                } : function () {
                    return n = n || {}, (n.icon === -1 || n.icon === t && !o.config.skin) && (n.skin = c + " " + (n.skin || "layui-layer-hui")), n
                }()))
            },
            load: function (e, t) {
                return r.open(i.extend({
                    type: 3,
                    icon: e || 0,
                    resize: !1,
                    shade: .01
                }, t))
            },
            tips: function (e, t, n) {
                return r.open(i.extend({
                    type: 4,
                    content: [e, t],
                    closeBtn: !1,
                    time: 3e3,
                    shade: !1,
                    resize: !1,
                    fixed: !1,
                    maxWidth: 210
                }, n))
            }
        },
        s = function (e) {
            var t = this;
            t.index = ++r.index, t.config = i.extend({}, t.config, o.config, e), document.body ? t.creat() : setTimeout(function () {
                t.creat()
            }, 30)
        };
    s.pt = s.prototype;
    var l = ["layui-layer", ".layui-layer-title", ".layui-layer-main", ".layui-layer-dialog", "layui-layer-iframe", "layui-layer-content", "layui-layer-btn", "layui-layer-close"];
    l.anim = ["layer-anim-00", "layer-anim-01", "layer-anim-02", "layer-anim-03", "layer-anim-04", "layer-anim-05", "layer-anim-06"], s.pt.config = {
        type: 0,
        shade: .3,
        fixed: !0,
        move: l[1],
        title: dr_lang('查看'),
        offset: "auto",
        area: "auto",
        closeBtn: 1,
        time: 0,
        zIndex: 19891014,
        maxWidth: 360,
        anim: 0,
        isOutAnim: !0,
        icon: -1,
        moveType: 1,
        resize: !0,
        scrollbar: !0,
        tips: 2
    }, s.pt.vessel = function (e, t) {
        var n = this,
            a = n.index,
            r = n.config,
            s = r.zIndex + a,
            f = "object" == typeof r.title,
            c = r.maxmin && (1 === r.type || 2 === r.type),
            u = r.title ? '<div class="layui-layer-title" style="' + (f ? r.title[1] : "") + '">' + (f ? r.title[0] : r.title) + "</div>" : "";
        return r.zIndex = s, t([r.shade ? '<div class="layui-layer-shade" id="layui-layer-shade' + a + '" times="' + a + '" style="' + ("z-index:" + (s - 1) + "; ") + '"></div>' : "", '<div class="' + l[0] + (" layui-layer-" + o.type[r.type]) + (0 != r.type && 2 != r.type || r.shade ? "" : " layui-layer-border") + " " + (r.skin || "") + '" id="' + l[0] + a + '" type="' + o.type[r.type] + '" times="' + a + '" showtime="' + r.time + '" conType="' + (e ? "object" : "string") + '" style="z-index: ' + s + "; width:" + r.area[0] + ";height:" + r.area[1] + (r.fixed ? "" : ";position:absolute;") + '">' + (e && 2 != r.type ? "" : u) + '<div id="' + (r.id || "") + '" class="layui-layer-content' + (0 == r.type && r.icon !== -1 ? " layui-layer-padding" : "") + (3 == r.type ? " layui-layer-loading" + r.icon : "") + '">' + (0 == r.type && r.icon !== -1 ? '<i class="layui-layer-ico layui-layer-ico' + r.icon + '"></i>' : "") + (1 == r.type && e ? "" : r.content || "") + '</div><span class="layui-layer-setwin">' + function () {
            var e = c ? '<a class="layui-layer-min" href="javascript:;"><cite></cite></a><a class="layui-layer-ico layui-layer-max" href="javascript:;"></a>' : "";
            return r.closeBtn && (e += '<a class="layui-layer-ico ' + l[7] + " " + l[7] + (r.title ? r.closeBtn : 4 == r.type ? "1" : "2") + '" href="javascript:;"></a>'), e
        }() + "</span>" + (r.btn ? function () {
            var e = "";
            "string" == typeof r.btn && (r.btn = [r.btn]);
            for (var t = 0, i = r.btn.length; t < i; t++) e += '<a class="' + l[6] + t + '">' + r.btn[t] + "</a>";
            return '<div class="' + l[6] + " layui-layer-btn-" + (r.btnAlign || "") + '">' + e + "</div>"
        }() : "") + (r.resize ? '<span class="layui-layer-resize"></span>' : "") + "</div>"], u, i('<div class="layui-layer-move"></div>')), n
    }, s.pt.creat = function () {
        var e = this,
            t = e.config,
            a = e.index,
            s = t.content,
            f = "object" == typeof s,
            c = i("body");
        if (!t.id || !i("#" + t.id)[0]) {
            switch ("string" == typeof t.area && (t.area = "auto" === t.area ? ["", ""] : [t.area, ""]), t.shift && (t.anim = t.shift), 6 == r.ie && (t.fixed = !1), t.type) {
                case 0:
                    t.btn = "btn" in t ? t.btn : o.btn[0], r.closeAll("dialog");
                    break;
                case 2:
                    var s = t.content = f ? t.content : [t.content || "http://layer.layui.com", "auto"];
                    t.content = '<iframe scrolling="' + (t.content[1] || "auto") + '" allowtransparency="true" id="' + l[4] + a + '" name="' + l[4] + a + '" onload="this.className=\'\';" class="layui-layer-load" frameborder="0" src="' + t.content[0] + '"></iframe>';
                    break;
                case 3:
                    delete t.title, delete t.closeBtn, t.icon === -1 && 0 === t.icon, r.closeAll("loading");
                    break;
                case 4:
                    f || (t.content = [t.content, "body"]), t.follow = t.content[1], t.content = t.content[0] + '<i class="layui-layer-TipsG"></i>', delete t.title, t.tips = "object" == typeof t.tips ? t.tips : [t.tips, !0], t.tipsMore || r.closeAll("tips")
            }
            if (e.vessel(f, function (n, r, u) {
                    c.append(n[0]), f ? function () {
                        2 == t.type || 4 == t.type ? function () {
                            i("body").append(n[1])
                        }() : function () {
                            s.parents("." + l[0])[0] || (s.data("display", s.css("display")).show().addClass("layui-layer-wrap").wrap(n[1]), i("#" + l[0] + a).find("." + l[5]).before(r))
                        }()
                    }() : c.append(n[1]), i(".layui-layer-move")[0] || c.append(o.moveElem = u), e.layero = i("#" + l[0] + a), t.scrollbar || l.html.css("overflow1", "hidden1").attr("layer-full", a)
                }).auto(a), i("#layui-layer-shade" + e.index).css({
                    "background-color": t.shade[1] || "#000",
                    opacity: t.shade[0] || t.shade
                }), 2 == t.type && 6 == r.ie && e.layero.find("iframe").attr("src", s[0]), 4 == t.type ? e.tips() : e.offset(), t.fixed && n.on("resize", function () {
                    e.offset(), (/^\d+%$/.test(t.area[0]) || /^\d+%$/.test(t.area[1])) && e.auto(a), 4 == t.type && e.tips()
                }), t.time <= 0 || setTimeout(function () {
                    r.close(e.index)
                }, t.time), e.move().callback(), l.anim[t.anim]) {
                var u = "layer-anim " + l.anim[t.anim];
                e.layero.addClass(u).one("webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend", function () {
                    i(this).removeClass(u)
                })
            }
            t.isOutAnim && e.layero.data("isOutAnim", !0)
        }
    }, s.pt.auto = function (e) {
        var t = this,
            a = t.config,
            o = i("#" + l[0] + e);
        "" === a.area[0] && a.maxWidth > 0 && (r.ie && r.ie < 8 && a.btn && o.width(o.innerWidth()), o.outerWidth() > a.maxWidth && o.width(a.maxWidth));
        var s = [o.innerWidth(), o.innerHeight()],
            f = o.find(l[1]).outerHeight() || 0,
            c = o.find("." + l[6]).outerHeight() || 0,
            u = function (e) {
                e = o.find(e), e.height(s[1] - f - c - 2 * (0 | parseFloat(e.css("padding-top"))))
            };
        switch (a.type) {
            case 2:
                u("iframe");
                break;
            default:
                "" === a.area[1] ? a.maxHeight > 0 && o.outerHeight() > a.maxHeight ? (s[1] = a.maxHeight, u("." + l[5])) : a.fixed && s[1] >= n.height() && (s[1] = n.height(), u("." + l[5])) : u("." + l[5])
        }
        return t
    }, s.pt.offset = function () {
        var e = this,
            t = e.config,
            i = e.layero,
            a = [i.outerWidth(), i.outerHeight()],
            o = "object" == typeof t.offset;
        e.offsetTop = (n.height() - a[1]) / 2, e.offsetLeft = (n.width() - a[0]) / 2, o ? (e.offsetTop = t.offset[0], e.offsetLeft = t.offset[1] || e.offsetLeft) : "auto" !== t.offset && ("t" === t.offset ? e.offsetTop = 0 : "r" === t.offset ? e.offsetLeft = n.width() - a[0] : "b" === t.offset ? e.offsetTop = n.height() - a[1] : "l" === t.offset ? e.offsetLeft = 0 : "lt" === t.offset ? (e.offsetTop = 0, e.offsetLeft = 0) : "lb" === t.offset ? (e.offsetTop = n.height() - a[1], e.offsetLeft = 0) : "rt" === t.offset ? (e.offsetTop = 0, e.offsetLeft = n.width() - a[0]) : "rb" === t.offset ? (e.offsetTop = n.height() - a[1], e.offsetLeft = n.width() - a[0]) : e.offsetTop = t.offset), t.fixed || (e.offsetTop = /%$/.test(e.offsetTop) ? n.height() * parseFloat(e.offsetTop) / 100 : parseFloat(e.offsetTop), e.offsetLeft = /%$/.test(e.offsetLeft) ? n.width() * parseFloat(e.offsetLeft) / 100 : parseFloat(e.offsetLeft), e.offsetTop += n.scrollTop(), e.offsetLeft += n.scrollLeft()), i.attr("minLeft") && (e.offsetTop = n.height() - (i.find(l[1]).outerHeight() || 0), e.offsetLeft = i.css("left")), i.css({
            top: e.offsetTop,
            left: e.offsetLeft
        })
    }, s.pt.tips = function () {
        var e = this,
            t = e.config,
            a = e.layero,
            o = [a.outerWidth(), a.outerHeight()],
            r = i(t.follow);
        r[0] || (r = i("body"));
        var s = {
                width: r.outerWidth(),
                height: r.outerHeight(),
                top: r.offset().top,
                left: r.offset().left
            },
            f = a.find(".layui-layer-TipsG"),
            c = t.tips[0];
        t.tips[1] || f.remove(), s.autoLeft = function () {
            s.left + o[0] - n.width() > 0 ? (s.tipLeft = s.left + s.width - o[0], f.css({
                right: 12,
                left: "auto"
            })) : s.tipLeft = s.left
        }, s.where = [function () {
            s.autoLeft(), s.tipTop = s.top - o[1] - 10, f.removeClass("layui-layer-TipsB").addClass("layui-layer-TipsT").css("border-right-color", t.tips[1])
        }, function () {
            s.tipLeft = s.left + s.width + 10, s.tipTop = s.top, f.removeClass("layui-layer-TipsL").addClass("layui-layer-TipsR").css("border-bottom-color", t.tips[1])
        }, function () {
            s.autoLeft(), s.tipTop = s.top + s.height + 10, f.removeClass("layui-layer-TipsT").addClass("layui-layer-TipsB").css("border-right-color", t.tips[1])
        }, function () {
            s.tipLeft = s.left - o[0] - 10, s.tipTop = s.top, f.removeClass("layui-layer-TipsR").addClass("layui-layer-TipsL").css("border-bottom-color", t.tips[1])
        }], s.where[c - 1](), 1 === c ? s.top - (n.scrollTop() + o[1] + 16) < 0 && s.where[2]() : 2 === c ? n.width() - (s.left + s.width + o[0] + 16) > 0 || s.where[3]() : 3 === c ? s.top - n.scrollTop() + s.height + o[1] + 16 - n.height() > 0 && s.where[0]() : 4 === c && o[0] + 16 - s.left > 0 && s.where[1](), a.find("." + l[5]).css({
            "background-color": t.tips[1],
            "padding-right": t.closeBtn ? "30px" : ""
        }), a.css({
            left: s.tipLeft - (t.fixed ? n.scrollLeft() : 0),
            top: s.tipTop - (t.fixed ? n.scrollTop() : 0)
        })
    }, s.pt.move = function () {
        var e = this,
            t = e.config,
            a = i(document),
            s = e.layero,
            l = s.find(t.move),
            f = s.find(".layui-layer-resize"),
            c = {};
        return t.move && l.css("cursor", "move"), l.on("mousedown", function (e) {
            e.preventDefault(), t.move && (c.moveStart = !0, c.offset = [e.clientX - parseFloat(s.css("left")), e.clientY - parseFloat(s.css("top"))], o.moveElem.css("cursor", "move").show())
        }), f.on("mousedown", function (e) {
            e.preventDefault(), c.resizeStart = !0, c.offset = [e.clientX, e.clientY], c.area = [s.outerWidth(), s.outerHeight()], o.moveElem.css("cursor", "se-resize").show()
        }), a.on("mousemove", function (i) {
            if (c.moveStart) {
                var a = i.clientX - c.offset[0],
                    o = i.clientY - c.offset[1],
                    l = "fixed" === s.css("position");
                if (i.preventDefault(), c.stX = l ? 0 : n.scrollLeft(), c.stY = l ? 0 : n.scrollTop(), !t.moveOut) {
                    var f = n.width() - s.outerWidth() + c.stX,
                        u = n.height() - s.outerHeight() + c.stY;
                    a < c.stX && (a = c.stX), a > f && (a = f), o < c.stY && (o = c.stY), o > u && (o = u)
                }
                s.css({
                    left: a,
                    top: o
                })
            }
            if (t.resize && c.resizeStart) {
                var a = i.clientX - c.offset[0],
                    o = i.clientY - c.offset[1];
                i.preventDefault(), r.style(e.index, {
                    width: c.area[0] + a,
                    height: c.area[1] + o
                }), c.isResize = !0, t.resizing && t.resizing(s)
            }
        }).on("mouseup", function (e) {
            c.moveStart && (delete c.moveStart, o.moveElem.hide(), t.moveEnd && t.moveEnd(s)), c.resizeStart && (delete c.resizeStart, o.moveElem.hide())
        }), e
    }, s.pt.callback = function () {
        function e() {
            var e = a.cancel && a.cancel(t.index, n);
            e === !1 || r.close(t.index)
        }
        var t = this,
            n = t.layero,
            a = t.config;
        t.openLayer(), a.success && (2 == a.type ? n.find("iframe").on("load", function () {
            a.success(n, t.index)
        }) : a.success(n, t.index)), 6 == r.ie && t.IE6(n), n.find("." + l[6]).children("a").on("click", function () {
            var e = i(this).index();
            if (0 === e) a.yes ? a.yes(t.index, n) : a.btn1 ? a.btn1(t.index, n) : r.close(t.index);
            else {
                var o = a["btn" + (e + 1)] && a["btn" + (e + 1)](t.index, n);
                o === !1 || r.close(t.index)
            }
        }), n.find("." + l[7]).on("click", e), a.shadeClose && i("#layui-layer-shade" + t.index).on("click", function () {
            r.close(t.index)
        }), n.find(".layui-layer-min").on("click", function () {
            var e = a.min && a.min(n);
            e === !1 || r.min(t.index, a)
        }), n.find(".layui-layer-max").on("click", function () {
            i(this).hasClass("layui-layer-maxmin") ? (r.restore(t.index), a.restore && a.restore(n)) : (r.full(t.index, a), setTimeout(function () {
                a.full && a.full(n)
            }, 100))
        }), a.end && (o.end[t.index] = a.end)
    }, o.reselect = function () {
        i.each(i("select"), function (e, t) {
            var n = i(this);
            n.parents("." + l[0])[0] || 1 == n.attr("layer") && i("." + l[0]).length < 1 && n.removeAttr("layer").show(), n = null
        })
    }, s.pt.IE6 = function (e) {
        i("select").each(function (e, t) {
            var n = i(this);
            n.parents("." + l[0])[0] || "none" === n.css("display") || n.attr({
                layer: "1"
            }).hide(), n = null
        })
    }, s.pt.openLayer = function () {
        var e = this;
        r.zIndex = e.config.zIndex, r.setTop = function (e) {
            var t = function () {
                r.zIndex++, e.css("z-index", r.zIndex + 1)
            };
            return r.zIndex = parseInt(e[0].style.zIndex), e.on("mousedown", t), r.zIndex
        }
    }, o.record = function (e) {
        var t = [e.width(), e.height(), e.position().top, e.position().left + parseFloat(e.css("margin-left"))];
        e.find(".layui-layer-max").addClass("layui-layer-maxmin"), e.attr({
            area: t
        })
    }, o.rescollbar = function (e) {
        l.html.attr("layer-full") == e && (l.html[0].style.removeProperty ? l.html[0].style.removeProperty("overflow") : l.html[0].style.removeAttribute("overflow"), l.html.removeAttr("layer-full"))
    }, e.layer = r, r.getChildFrame = function (e, t) {
        return t = t || i("." + l[4]).attr("times"), i("#" + l[0] + t).find("iframe").contents().find(e)
    }, r.getFrameIndex = function (e) {
        return i("#" + e).parents("." + l[4]).attr("times")
    }, r.iframeAuto = function (e) {
        if (e) {
            var t = r.getChildFrame("html", e).outerHeight(),
                n = i("#" + l[0] + e),
                a = n.find(l[1]).outerHeight() || 0,
                o = n.find("." + l[6]).outerHeight() || 0;
            n.css({
                height: t + a + o
            }), n.find("iframe").css({
                height: t
            })
        }
    }, r.iframeSrc = function (e, t) {
        i("#" + l[0] + e).find("iframe").attr("src", t)
    }, r.style = function (e, t, n) {
        var a = i("#" + l[0] + e),
            r = a.find(".layui-layer-content"),
            s = a.attr("type"),
            f = a.find(l[1]).outerHeight() || 0,
            c = a.find("." + l[6]).outerHeight() || 0;
        a.attr("minLeft");
        s !== o.type[3] && s !== o.type[4] && (n || (parseFloat(t.width) <= 260 && (t.width = 260), parseFloat(t.height) - f - c <= 64 && (t.height = 64 + f + c)), a.css(t), c = a.find("." + l[6]).outerHeight(), s === o.type[2] ? a.find("iframe").css({
            height: parseFloat(t.height) - f - c
        }) : r.css({
            height: parseFloat(t.height) - f - c - parseFloat(r.css("padding-top")) - parseFloat(r.css("padding-bottom"))
        }))
    }, r.min = function (e, t) {
        var a = i("#" + l[0] + e),
            s = a.find(l[1]).outerHeight() || 0,
            f = a.attr("minLeft") || 181 * o.minIndex + "px",
            c = a.css("position");
        o.record(a), o.minLeft[0] && (f = o.minLeft[0], o.minLeft.shift()), a.attr("position", c), r.style(e, {
            width: 180,
            height: s,
            left: f,
            top: n.height() - s,
            position: "fixed",
            overflow: "hidden"
        }, !0), a.find(".layui-layer-min").hide(), "page" === a.attr("type") && a.find(l[4]).hide(), o.rescollbar(e), a.attr("minLeft") || o.minIndex++, a.attr("minLeft", f)
    }, r.restore = function (e) {
        var t = i("#" + l[0] + e),
            n = t.attr("area").split(",");
        t.attr("type");
        r.style(e, {
            width: parseFloat(n[0]),
            height: parseFloat(n[1]),
            top: parseFloat(n[2]),
            left: parseFloat(n[3]),
            position: t.attr("position"),
            overflow: "visible"
        }, !0), t.find(".layui-layer-max").removeClass("layui-layer-maxmin"), t.find(".layui-layer-min").show(), "page" === t.attr("type") && t.find(l[4]).show(), o.rescollbar(e)
    }, r.full = function (e) {
        var t, a = i("#" + l[0] + e);
        o.record(a), l.html.attr("layer-full") || l.html.css("overflow", "hidden").attr("layer-full", e), clearTimeout(t), t = setTimeout(function () {
            var t = "fixed" === a.css("position");
            r.style(e, {
                top: t ? 50 : n.scrollTop(),
                left: t ? 0 : n.scrollLeft(),
                width: n.width(),
                height: n.height() - 50
            }, !0), a.find(".layui-layer-min").hide()
        }, 100)
    }, r.title = function (e, t) {
        var n = i("#" + l[0] + (t || r.index)).find(l[1]);
        n.html(e)
    }, r.close = function (e) {
        var t = i("#" + l[0] + e),
            n = t.attr("type"),
            a = "layer-anim-close";
        if (t[0]) {
            var s = "layui-layer-wrap",
                f = function () {
                    if (n === o.type[1] && "object" === t.attr("conType")) {
                        t.children(":not(." + l[5] + ")").remove();
                        for (var a = t.find("." + s), r = 0; r < 2; r++) a.unwrap();
                        a.css("display", a.data("display")).removeClass(s)
                    } else {
                        if (n === o.type[2]) try {
                            var f = i("#" + l[4] + e)[0];
                            f.contentWindow.document.write(""), f.contentWindow.close(), t.find("." + l[5])[0].removeChild(f)
                        } catch (c) {}
                        t[0].innerHTML = "", t.remove()
                    }
                    "function" == typeof o.end[e] && o.end[e](), delete o.end[e]
                };
            t.data("isOutAnim") && t.addClass("layer-anim " + a), i("#layui-layer-moves, #layui-layer-shade" + e).remove(), 6 == r.ie && o.reselect(), o.rescollbar(e), t.attr("minLeft") && (o.minIndex--, o.minLeft.push(t.attr("minLeft"))), r.ie && r.ie < 10 || !t.data("isOutAnim") ? f() : setTimeout(function () {
                f()
            }, 200)
        }
    }, r.closeAll = function (e) {
        i.each(i("." + l[0]), function () {
            var t = i(this),
                n = e ? t.attr("type") === e : 1;
            n && r.close(t.attr("times")), n = null
        })
    };
    var f = r.cache || {},
        c = function (e) {
            return f.skin ? " " + f.skin + " " + f.skin + "-" + e : ""
        };
    r.prompt = function (e, t) {
        var a = "";
        if (e = e || {}, "function" == typeof e && (t = e), e.area) {
            var o = e.area;
            a = 'style="width: ' + o[0] + "; height: " + o[1] + ';"', delete e.area
        }
        var s, l = 2 == e.formType ? '<textarea class="layui-layer-input"' + a + ">" + (e.value || "") + "</textarea>" : function () {
                return '<input type="' + (1 == e.formType ? "password" : "text") + '" class="layui-layer-input" value="' + (e.value || "") + '">'
            }(),
            f = e.success;
        return delete e.success, r.open(i.extend({
            type: 1,
            btn: [dr_lang('确定'), dr_lang('取消')],
            content: l,
            skin: "layui-layer-prompt" + c("prompt"),
            maxWidth: n.width(),
            success: function (e) {
                s = e.find(".layui-layer-input"), s.focus(), "function" == typeof f && f(e)
            },
            resize: !1,
            yes: function (i) {
                var n = s.val();
                "" === n ? s.focus() : n.length > (e.maxlength || 500) ? r.tips("最多输入" + (e.maxlength || 500) + "个字数", s, {
                    tips: 1
                }) : t && t(n, i, s)
            }
        }, e))
    }, r.tab = function (e) {
        e = e || {};
        var t = e.tab || {},
            n = "layui-this",
            a = e.success;
        return delete e.success, r.open(i.extend({
            type: 1,
            skin: "layui-layer-tab" + c("tab"),
            resize: !1,
            title: function () {
                var e = t.length,
                    i = 1,
                    a = "";
                if (e > 0)
                    for (a = '<span class="' + n + '">' + t[0].title + "</span>"; i < e; i++) a += "<span>" + t[i].title + "</span>";
                return a
            }(),
            content: '<ul class="layui-layer-tabmain">' + function () {
                var e = t.length,
                    i = 1,
                    a = "";
                if (e > 0)
                    for (a = '<li class="layui-layer-tabli ' + n + '">' + (t[0].content || "no content") + "</li>"; i < e; i++) a += '<li class="layui-layer-tabli">' + (t[i].content || "no  content") + "</li>";
                return a
            }() + "</ul>",
            success: function (t) {
                var o = t.find(".layui-layer-title").children(),
                    r = t.find(".layui-layer-tabmain").children();
                o.on("mousedown", function (t) {
                    t.stopPropagation ? t.stopPropagation() : t.cancelBubble = !0;
                    var a = i(this),
                        o = a.index();
                    a.addClass(n).siblings().removeClass(n), r.eq(o).show().siblings().hide(), "function" == typeof e.change && e.change(o)
                }), "function" == typeof a && a(t)
            }
        }, e))
    }, r.photos = function (t, n, a) {
        function o(e, t, i) {
            var n = new Image;
            return n.src = e, n.complete ? t(n) : (n.onload = function () {
                n.onload = null, t(n)
            }, void(n.onerror = function (e) {
                n.onerror = null, i(e)
            }))
        }
        var s = {};
        if (t = t || {}, t.photos) {
            var l = t.photos.constructor === Object,
                f = l ? t.photos : {},
                u = f.data || [],
                d = f.start || 0;
            s.imgIndex = (0 | d) + 1, t.img = t.img || "img";
            var y = t.success;
            if (delete t.success, l) {
                if (0 === u.length) return r.msg("没有图片")
            } else {
                var p = i(t.photos),
                    h = function () {
                        u = [], p.find(t.img).each(function (e) {
                            var t = i(this);
                            t.attr("layer-index", e), u.push({
                                alt: t.attr("alt"),
                                pid: t.attr("layer-pid"),
                                src: t.attr("layer-src") || t.attr("src"),
                                thumb: t.attr("src")
                            })
                        })
                    };
                if (h(), 0 === u.length) return;
                if (n || p.on("click", t.img, function () {
                        var e = i(this),
                            n = e.attr("layer-index");
                        r.photos(i.extend(t, {
                            photos: {
                                start: n,
                                data: u,
                                tab: t.tab
                            },
                            full: t.full
                        }), !0), h()
                    }), !n) return
            }
            s.imgprev = function (e) {
                s.imgIndex--, s.imgIndex < 1 && (s.imgIndex = u.length), s.tabimg(e)
            }, s.imgnext = function (e, t) {
                s.imgIndex++, s.imgIndex > u.length && (s.imgIndex = 1, t) || s.tabimg(e)
            }, s.keyup = function (e) {
                if (!s.end) {
                    var t = e.keyCode;
                    e.preventDefault(), 37 === t ? s.imgprev(!0) : 39 === t ? s.imgnext(!0) : 27 === t && r.close(s.index)
                }
            }, s.tabimg = function (e) {
                if (!(u.length <= 1)) return f.start = s.imgIndex - 1, r.close(s.index), r.photos(t, !0, e)
            }, s.event = function () {
                s.bigimg.hover(function () {
                    s.imgsee.show()
                }, function () {
                    s.imgsee.hide()
                }), s.bigimg.find(".layui-layer-imgprev").on("click", function (e) {
                    e.preventDefault(), s.imgprev()
                }), s.bigimg.find(".layui-layer-imgnext").on("click", function (e) {
                    e.preventDefault(), s.imgnext()
                }), i(document).on("keyup", s.keyup)
            }, s.loadi = r.load(1, {
                shade: !("shade" in t) && .9,
                scrollbar: !1
            }), o(u[d].src, function (n) {
                r.close(s.loadi), s.index = r.open(i.extend({
                    type: 1,
                    id: "layui-layer-photos",
                    area: function () {
                        var a = [n.width, n.height],
                            o = [i(e).width() - 100, i(e).height() - 100];
                        if (!t.full && (a[0] > o[0] || a[1] > o[1])) {
                            var r = [a[0] / o[0], a[1] / o[1]];
                            r[0] > r[1] ? (a[0] = a[0] / r[0], a[1] = a[1] / r[0]) : r[0] < r[1] && (a[0] = a[0] / r[1], a[1] = a[1] / r[1])
                        }
                        return [a[0] + "px", a[1] + "px"]
                    }(),
                    title: !1,
                    shade: .9,
                    shadeClose: !0,
                    closeBtn: !1,
                    move: ".layui-layer-phimg img",
                    moveType: 1,
                    scrollbar: !1,
                    moveOut: !0,
                    isOutAnim: !1,
                    skin: "layui-layer-photos" + c("photos"),
                    content: '<div class="layui-layer-phimg"><img src="' + u[d].src + '" alt="' + (u[d].alt || "") + '" layer-pid="' + u[d].pid + '"><div class="layui-layer-imgsee">' + (u.length > 1 ? '<span class="layui-layer-imguide"><a href="javascript:;" class="layui-layer-iconext layui-layer-imgprev"></a><a href="javascript:;" class="layui-layer-iconext layui-layer-imgnext"></a></span>' : "") + '<div class="layui-layer-imgbar" style="display:' + (a ? "block" : "") + '"><span class="layui-layer-imgtit"><a href="javascript:;">' + (u[d].alt || "") + "</a><em>" + s.imgIndex + "/" + u.length + "</em></span></div></div></div>",
                    success: function (e, i) {
                        s.bigimg = e.find(".layui-layer-phimg"), s.imgsee = e.find(".layui-layer-imguide,.layui-layer-imgbar"), s.event(e), t.tab && t.tab(u[d], e), "function" == typeof y && y(e)
                    },
                    end: function () {
                        s.end = !0, i(document).off("keyup", s.keyup)
                    }
                }, t))
            }, function () {
                r.close(s.loadi), r.msg("当前图片地址异常<br>是否继续查看下一张？", {
                    time: 3e4,
                    btn: ["下一张", "不看了"],
                    yes: function () {
                        u.length > 1 && s.imgnext(!0, !0)
                    }
                })
            })
        }
    }, o.run = function (t) {
        i = t, n = i(e), l.html = i("html"), r.open = function (e) {
            var t = new s(e);
            return t.index
        }
    }, e.layui && layui.define ? (r.ready(), layui.define("jquery", function (t) {
        r.path = layui.cache.dir, o.run(layui.$), e.layer = r, t("layer", r)
    })) : "function" == typeof define && define.amd ? define(["jquery"], function () {
        return o.run(e.jQuery), r
    }) : function () {
        o.run(e.jQuery), r.ready()
    }()
}(window);